package com.ze.sys.event;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Person事件发布者
 */
@Service
@Slf4j
public class PersonEventPublisher {

    @Resource
    private ApplicationEventPublisher applicationEventPublisher;

    public void createPerson(Person person) {
        applicationEventPublisher.publishEvent(
                new PersonChangeEvent(person, "create"));
    }

    public void updatePerson(Person person) {
        applicationEventPublisher.publishEvent(
                new PersonChangeEvent(person, "update"));
    }
}